<?php

if (!function_exists('array_keys_exist')) {
    function array_keys_exist($array, $params = [])
    {
        if (!is_array($array) || !is_array($params)) {
            return false;
        }

        foreach ($params as $param) {
            if (!array_key_exists($param, $array)) {
                return false;
            }
        }

        return true;
    }
}

if (!function_exists('getallheaders')) {
    function getallheaders() : array
    {
        $headers = [];
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
            }
        }

        return $headers;
    }
}
